home *** CD-ROM | disk | FTP | other *** search
- Path: news.spies.com!usenet
- From: Erik Max Francis <max@alcyone.com>
- Newsgroups: comp.lang.c
- Subject: Re: Passing Function Pointers
- Date: Tue, 02 Apr 1996 08:15:30 -0800
- Organization: Alcyone Systems
- Message-ID: <316152A2.6A1B5ED6@alcyone.com>
- References: <315E7284.479F@sooner.net>
- NNTP-Posting-Host: newton.alcyone.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i486)
-
- Eddie Bush wrote:
-
- > I made *fn an int because it didn't like the void, and now instead of
- > complaining about that it complains about - well, here's the error
- > message:
- >
- > Error LIST.H 71: Call to nonfunction.
- >
- > Any ideas? It isn't 'clicking' for me.
-
- The reason is because (surprise!) you are passing a pointer to an int, not a
- pointer to a function returning int and taking one argument which is a l_node.
- (But if you're going to delete it, don't you want it to be an l_node *? Maybe
- you've already typedef'd it this way.)
-
- The prototype should look this:
-
- void delete(list *myList, int (*function)(l_node));
-
- --
- Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max@alcyone.com
- San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
- H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
- Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem
- "Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_
-